package com.gy.ai.agent.platform.dashscope.entity;

import com.alibaba.fastjson2.annotation.JSONField;
import com.gy.ai.agent.core.ReqOptions;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * @author LGY
 * Create by 2025/6/19 17:02
 */
@Data
@Accessors(chain = true)
public class DashscopePlatformChatReq extends ReqOptions implements Serializable {

    private String model;

    private List<Message> messages;

    private Boolean stream;

    private StreamOptions stream_options;

    private List<String> modalities;

    private Audio audio;

    private BigDecimal temperature;

    private BigDecimal top_p;

    private Integer top_k;

    private BigDecimal presence_penalty;

    private ResponseFormat response_format;

    private Integer max_tokens;

    private Integer n;

    private Boolean enable_thinking;

    private Integer thinking_budget;

    private Integer seed;

    private Boolean logprobs;

    private Integer top_logprobs;

    private Object stop;

    private List<Object> tools;

    private Object tool_choice;

    private Boolean parallel_tool_calls;

    private Object translation_options;

    private Boolean enable_search;

    private Object search_options;

    @JSONField(name = "X-DashScope-DataInspection")
    private String xDashScopeDataInspection;

    @Data
    @Accessors(chain = true)
    public static class Tool implements Serializable {

        private String type;

        private FunctionTool function;
    }

    @Data
    @Accessors(chain = true)
    public static class FunctionTool implements Serializable {

        private String type;

        private String description;

        private Object parameters;
    }

    @Data
    @Accessors(chain = true)
    public static class ResponseFormat implements Serializable {

        private String type;
    }


    @Data
    @Accessors(chain = true)
    public static class Audio implements Serializable {

        private String voice;

        private String format;
    }


    @Data
    @Accessors(chain = true)
    public static class StreamOptions implements Serializable {

        private Boolean include_usage;
    }

    @Data
    @Accessors(chain = true)
    public static class Message implements Serializable {

        private String role;

        private String content;

        private Boolean partial;

        private List<ToolCalls> tool_calls;

        private String tool_call_id;
    }

    @Data
    @Accessors(chain = true)
    public static class ToolCalls implements Serializable {

        private String id;

        private String type;

        private Function function;

        private Integer index;
    }

    @Data
    @Accessors(chain = true)
    public static class Function implements Serializable {

        private String name;

        private String arguments;

    }

}
